<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>物品移交</title>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript">

function next(url){
	window.location.href = url;
}
function openChooseAssessor(){
		// var url ="${ctx }/common_employeeQuery.do?method=initMain&parentFrameId=goodTransfer&methodName=setHandover";
	 	// top.windowOpen(url,"chooseAssessor","${key.choose_person}",350,550,true,"assessorIfm");
	  	var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain";
	  	url += "&frameName=goodTransfer";
	  	url += "&callBack=setPersonInfo";
	  	url += "&multiple=false";
		top.windowOpen(url, "selectPerson", "选人", 530, 700,true,"selectPerson");
}
function setPersonInfo(info){ //设置选人信息
	  var onePerson= new Array();
	  onePerson=info.split(";");
	    for (i=0;i<onePerson.length ;i++ )
	    {
	     var oneAttribute= new Array();
	     oneAttribute=onePerson[i].split(",");
		 $('handoverManId').value=oneAttribute[0];
		 $('handoverManName').value=oneAttribute[1];
		 $('handoverManName').fireEvent("onblur");
		}
}
function setHandover(id,name){
		$('handoverManId').value=id;
		$('handoverManName').value=name;
		$('handoverManName').fireEvent("onblur");
}
function addGoodsTransfer(){
	if(window.frames["goodsList"].validateInput()){
		return false;
	}
	setThingHandoverItem();
	var isTrue=$('goodsTransferForm').fireEvent("onSubmit") ;
    if(isTrue){
        var param = Form.serialize('goodsTransferForm');
        var url = null;
		url = "${ctx}/occupation_joinHandleAction.do?method=editGoodsTransfer&identityValidateId=${identityId}";
        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResult});
	}
}
function showResult(response){
    ajaxSubmitException(response.responseText);
	var obj=findFrame('identityMain');
	obj.reloadIdentity();
	windowClose();
}
function setThingHandoverItem(){
	$('thingHandoverItemStr').value = window.frames["goodsList"].buildStr();
}
function init(){
	var radios = document.getElementsByName('handoverStatus');
	for(var i = 0 ; i < radios.length ; i++)
	{
		if('${thingHandover.handoverStatus }' == radios[i].value)
		{
		   radios[i].checked = true;
		   break;
		}
	}
}
</script>
</head>

<body onload="init()">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">物品移交</span> </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td colspan="2" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
		<tr>
          <td colspan="4" valign="top" class="aux_titletable">管理房号:${coalitionHouseNumber }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <c:if test="${identityValidate.joinMode eq '002' }">
          <span style="font-weight:normal"> 按管理房办理</span> </c:if>
          </td>
          </tr>
          <c:forEach items="${clientInfoSet}" var="client">
	        <tr>
	          <td valign="top" class="aux_intable_td1">相关房号：</td>
	          <td valign="top" class="aux_intable_td2">${client.realHouseNumber }</td>
	          <td valign="top" class="aux_intable_td1">业 主：</td>
	          <td class="aux_intable_td2">
	          		${client.realHouseClientInfo }
	          </td>
	        </tr>
	        </c:forEach>
          <tr>
            <td colspan="4" valign="top" class="aux_intable_td1"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab_line">
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tr>
                      <td colspan="5" >
                      	<iframe src="${ctx}/occupation_joinHandleAction.do?method=initGoodsList&identityId=${identityId }" name="goodsList" id="goodsList" width="100%" height="150px" frameborder="0" scrolling="auto"> </iframe>
                        </td>
                    </tr>
                </table></td>
              </tr>
            </table></td>
            </tr>
          <form  action="" name="goodsTransferForm" method="post" class="required-validate">
          <input type="hidden" name="thingHandoverItemStr">
          <input type="hidden" name="coalitionHouseNumber" value="${coalitionHouseNumber }">
          <input type="hidden" name="keyword" value="${thingHandover.keyword }">
          <tr id="tr01">
             <td class="aux_intable_td1">移交人：</td>
             <td class="aux_intable_require">
             <input type="hidden" name="handoverManId"  value="${thingHandover.handoverManId }" />
             <input name="handoverManName" readOnly="true" type="text" class="required" size="16" value="${thingHandover.handoverManName }" afterInsert="chargeCheckerSpan">
             <a href="#"  onClick="openChooseAssessor();" onFocus="this.blur()"><img src="${ctx }/images/ico_cz.gif" width="16" height="16" border="0" ></a><span id="chargeCheckerSpan"></span></td>
             <td class="aux_intable_td1">移交日期：</td>
             <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td><input name="handoverDate" type="text"
                   			  class="required validate-date-yyyy-MM-dd validate-ajax" replaceId="dataValue"
                   			  validateUrl="${ctx}/common_sysrefcodeAction.do?method=compareCurrentDate&dateFormat=yyyy-MM-dd&compareType=smallEqualsCurrentDate" validateMessage="输入的移交日期必须小于等于当前系统时间"
                   			  value="<fmt:formatDate value='${thingHandover.handoverDate }' pattern='yyyy-MM-dd'/>"
                   			  size="16" maxlength="10"/></td>
                   <td width="4">&nbsp;</td>
                   <td><img name="handoverDateButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" /></td>
                 </tr>
             </table></td>
          </tr>
		  <tr id="tr04">
		    <td class="aux_intable_td1">接受人：</td>
		    <td class="aux_intable_require">
		    <pms:unitedSelect
				name="accepter" dataList="${handoverList}" selectText="请选择..."
		 		optionLabel="participantName"
		 		value="${thingHandover.accepter}"
		 		className="select-one-required"
				optionValue="participantName">
			</pms:unitedSelect>
            </td>
		    <td rowspan="2" valign="top" class="aux_intable_td1">备 注：</td>
		    <td rowspan="2" valign="top" class="aux_intable_td2">
		      <textarea name="description" cols="29" rows="2" class="textareatext">${thingHandover.description }</textarea>
		    </td>
		  </tr>
		  <tr id="tr04">
		    <td class="aux_intable_td1">钥匙移交：</td>
		    <td class="aux_intable_require">
		    <input type="radio" name="handoverStatus"  value="1" class="validate-one-required"/>
		      是&nbsp;　&nbsp;　&nbsp;
			<input type="radio" name="handoverStatus" value="0" class="validate-one-required"/>
			 否</td>
		    </tr>
		    </form>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer">&nbsp;</td>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table border="0" cellpadding="0" cellspacing="0" onclick="addGoodsTransfer()">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22"  onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="buttonOffLeft" id="btn1_31"></td>
                <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
                <td class="buttonOffRight" id="btn1_33"></td>
              </tr>
          </table></td>
        </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script type="text/javascript">
Calendar.setup(
              {
	              inputField : "handoverDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "handoverDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
</script>
</body>
</html>